package com.jeff.vo;

import com.jeff.po.FormData;

import java.io.Serializable;
import java.util.List;
import java.util.UUID;

/**
 * 表单填写的数据
 * Created by King-z on 2019/2/10 0010.
 */
public class FormDataVo implements Serializable {
    private String id;
    private String createId;
    private String createIp;
    private String FormId;
    private List<FormData> elements;

    public FormDataVo() {
        UUID uuid = UUID.randomUUID();
        this.id = uuid.toString();
    }


    public List<FormData> getElements() {
        refreshLogs();
        return elements;
    }

    private void refreshLogs() {
        for (FormData element : elements) {
            element.setCreateId(this.getCreateId());
            element.setCreateIp(this.getCreateIp());
            element.setLogId(this.getId());
            element.setFormId(this.getFormId());
        }
    }

    public void setElements(List<FormData> elements) {
        this.elements = elements;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateId() {
        return createId;
    }

    public void setCreateId(String createId) {
        this.createId = createId;
    }

    public String getCreateIp() {
        return createIp;
    }

    public void setCreateIp(String createIp) {
        this.createIp = createIp;
    }

    public String getFormId() {
        return FormId;
    }

    public void setFormId(String formId) {
        FormId = formId;
    }
}
